library(tidyverse)Registered S3 methods overwritten by 'dbplyr':
method from
print.tbl_lazy
print.tbl_sql
── Attaching packages ──────────────────────────── tidyverse 1.3.2 ──✔ ggplot2 3.4.0 ✔ purrr 1.0.0
✔ tibble 3.1.8 ✔ dplyr 1.0.10
✔ tidyr 1.2.1 ✔ stringr 1.5.0
✔ readr 2.1.3 ✔ forcats 0.5.2 ── Conflicts ─────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
library(readxl) # for excel files
library(WDI)The following is useful when you use WDI.
wdi_cache <- WDIcache()web: https://cran.r-project.org/web/packages/owidR/readme/README.html
This package acts as an interface to Our World in Data datasets, allowing for an easy way to search through data used in over 3,000 charts and load them into the R environment.
To install from CRAN:
install.packages("owidR")library(owidR)Lets use the core functions to get data on how human rights have changed over time. First by searching for charts on human rights.
owid_search("human rights") %>% as_tibble()NALet’s use the human rights protection dataset.
rights <- owid("human-rights-protection")
rightsggplot2 makes it easy to visualise our data.
rights %>%
filter(entity %in% c("United Kingdom", "France", "United States", "Japan")) %>%
ggplot(aes(year, `Human rights protection`, colour = entity)) +
geom_line()The research question: does higher internet use lead to higher levels of democracy?
To begin we’ll load owidR using the library() function. We’ll also load tidyverse which we’ll be using to do the analysis.
# library(owidR)
# library(dplyr) # in tidyverse
# library(ggplot2) # in tidyverse
# library(plm) # Linear Models for Panel Data
# library(texreg) # Conversion of R Regression Output to LaTeX or HTML Tablesowid_search("internet") %>% as_tibble()Get a dataset used in an OWID chart.
internet <- owid("share-of-individuals-using-the-internet", rename = "internet_use")
internetGet source information on an OWID dataset
owid_source(internet)Dataset Name: International Telecommunication Union (via World Bank)
Published By: World Development Indicators - World Bank (2022.05.26)
Link: https://datacatalog.worldbank.org/search/dataset/0037712/World-Development-Indicators
A function that opens the original OWID chart in your browser.
view_chart(internet)Plot an owid dataset
owid_plot(internet, filter = "World") +
labs(title = "Share of the World Population using the Internet") +
scale_y_continuous(limits = c(0, 100))+
theme_owid()Warning: `owid_plot()` was deprecated in owidR 1.4.0.
Please use `ggplot2::ggplot()` instead.Warning: `theme_owid()` was deprecated in owidR 1.4.0.
Please use `ggplot2::theme()` instead.Loading required namespace: showtext
Failed with error: ‘there is no package called ‘showtext’’
Warning: importing fonts requires the showtext pacakgeLoading required namespace: showtext
Failed with error: ‘there is no package called ‘showtext’’
Warning: importing fonts requires the showtext pacakge
owid_plot(internet, summarise = FALSE, filter = c("United Kingdom", "Spain", "Russia", "Egypt", "Nigeria")) +
labs(title = "Share of Population with Using the Internet") +
scale_y_continuous(limits = c(0, 100), labels = scales::label_number(suffix = "%")) # The labels argument allows you to make it clear that the value is a percentageLoading required namespace: showtext
Failed with error: ‘there is no package called ‘showtext’’
Warning: importing fonts requires the showtext pacakgeWarning: 'scale_colour_owid' is deprecated.
See help("Deprecated")
creating a choropleth map
owid_map(internet, year = 2017) +
labs(title = "Share of Population Using the Internet, 2017")Warning: `owid_map()` was deprecated in owidR 1.4.0.
Please use `ggplot2::ggplot()` instead.Loading required namespace: showtext
Failed with error: ‘there is no package called ‘showtext’’
Warning: importing fonts requires the showtext pacakge
The second variable
owid_search("democrac") %>% as_tibble()democracy <- owid("electoral-democracy", rename = c("electoral_democracy", "vdem_high", "vdem_low"))
democracyowid_source(democracy)Value:
Dataset Name: OWID based on V-Dem (v12) and Lührmann et al. (2018)
Published By: Our World in Data, Bastian Herre
Link: http://v-dem.net/vdemds.html
This dataset provides information on democracy and human rights, using data from the Varieties of Democracy project (v12), and the Regimes of the World classification by Lührmann et al. (2018).
We expand the countries and years covered, and refine the coding of the Regimes of the World classification. You can read a detailed description of the data in these posts:
https://ourworldindata.org/regimes-of-the-world-data
https://ourworldindata.org/vdem-electoral-democracy-data
https://ourworldindata.org/vdem-human-rights-data
You can download the code and complete dataset, including supplementary variables, from GitHub: https://github.com/owid/notebooks/tree/main/BastianHerre/democracyValue:
Dataset Name: OWID based on V-Dem (v12) and Lührmann et al. (2018)
Published By: Our World in Data, Bastian Herre
Link: http://v-dem.net/vdemds.html
This dataset provides information on democracy and human rights, using data from the Varieties of Democracy project (v12), and the Regimes of the World classification by Lührmann et al. (2018).
We expand the countries and years covered, and refine the coding of the Regimes of the World classification. You can read a detailed description of the data in these posts:
https://ourworldindata.org/regimes-of-the-world-data
https://ourworldindata.org/vdem-electoral-democracy-data
https://ourworldindata.org/vdem-human-rights-data
You can download the code and complete dataset, including supplementary variables, from GitHub: https://github.com/owid/notebooks/tree/main/BastianHerre/democracyValue:
Dataset Name: OWID based on V-Dem (v12) and Lührmann et al. (2018)
Published By: Our World in Data, Bastian Herre
Link: http://v-dem.net/vdemds.html
This dataset provides information on democracy and human rights, using data from the Varieties of Democracy project (v12), and the Regimes of the World classification by Lührmann et al. (2018).
We expand the countries and years covered, and refine the coding of the Regimes of the World classification. You can read a detailed description of the data in these posts:
https://ourworldindata.org/regimes-of-the-world-data
https://ourworldindata.org/vdem-electoral-democracy-data
https://ourworldindata.org/vdem-human-rights-data
You can download the code and complete dataset, including supplementary variables, from GitHub: https://github.com/owid/notebooks/tree/main/BastianHerre/democracy
owid_map(democracy, year = 2015, palette = "YlGn") +
labs(title = "Electoral Democracy")Loading required namespace: showtext
Failed with error: ‘there is no package called ‘showtext’’
Warning: importing fonts requires the showtext pacakge
owid_plot(democracy, summarise = FALSE, filter = c("United Kingdom", "Spain", "Russia", "Egypt", "Nigeria")) +
labs(title = "electoral-democracy") +
scale_y_continuous(limits = c(0, 1), labels = scales::label_number(suffix = "%")) # The labels argument allows you to make it clear that the value is a percentageLoading required namespace: showtext
Failed with error: ‘there is no package called ‘showtext’’
Warning: importing fonts requires the showtext pacakgeWarning: 'scale_colour_owid' is deprecated.
See help("Deprecated")
#> Warning: 'scale_colour_owid' is deprecated.
#> See help("Deprecated")gdp <- owid("gdp-per-capita-worldbank", rename = "gdp")
gov_exp <- owid("total-gov-expenditure-gdp-wdi", rename = "gov_exp")
age_dep <- owid("age-dependency-ratio-of-working-age-population", rename = "age_dep")
unemployment <- owid("unemployment-rate", rename = "unemp")Mutating joins
left_join(): includes all rows in x.
data <- internet %>%
left_join(democracy) %>%
left_join(gdp) %>%
left_join(gov_exp) %>%
left_join(age_dep) %>%
left_join(unemployment)Joining, by = c("entity", "code", "year")Joining, by = c("entity", "code", "year")Joining, by = c("entity", "code", "year")Joining, by = c("entity", "code", "year")Joining, by = c("entity", "code", "year")
Drawing scatter plot
data %>%
filter(year == 2015) %>%
ggplot(aes(internet_use, electoral_democracy)) +
geom_point(colour = "#57677D", na.rm = TRUE) +
geom_smooth(method = "lm", colour = "#DC5E78", na.rm = TRUE) +
labs(title = "Relationship Between Internet Use and electoral_democracy", x = "Internet Use", y = "electoral_democracy") +
theme_owid()Failed with error: ‘there is no package called ‘showtext’’
data %>%
filter(year == 2015) %>%
ggplot(aes(gdp, internet_use)) +
geom_point(colour = "blue") +
geom_smooth(method = "gam", colour = "red", level = 0.0) +
labs(title = "Relationship Between Internet Use and GDP", x = "GDP", y = "Internet Use")model1 <- lm(electoral_democracy ~ internet_use, data)
summary(model1)
Call:
lm(formula = electoral_democracy ~ internet_use, data = data)
Residuals:
Min 1Q Median 3Q Max
-0.76097 -0.20192 0.02248 0.18764 0.48558
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.4283461 0.0042829 100.01 <2e-16 ***
internet_use 0.0035522 0.0001166 30.46 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.2475 on 5311 degrees of freedom
(1347 observations deleted due to missingness)
Multiple R-squared: 0.1487, Adjusted R-squared: 0.1485
F-statistic: 927.7 on 1 and 5311 DF, p-value: < 2.2e-16
model2 <- lm(gdp ~ internet_use, data)
summary(model2)
Call:
lm(formula = gdp ~ internet_use, data = data)
Residuals:
Min 1Q Median 3Q Max
-35872 -7670 -4496 3306 126683
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8101.982 276.503 29.30 <2e-16 ***
internet_use 413.174 7.315 56.48 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 16350 on 5872 degrees of freedom
(786 observations deleted due to missingness)
Multiple R-squared: 0.352, Adjusted R-squared: 0.3519
F-statistic: 3190 on 1 and 5872 DF, p-value: < 2.2e-16
Creating a table of the results of the regression analysis
library(texreg)Version: 1.38.6
Date: 2022-04-06
Author: Philip Leifeld (University of Essex)
Consider submitting praise using the praise or praise_interactive functions.
Please cite the JSS article in your publications -- see citation("texreg").
Attaching package: ‘texreg’
The following object is masked from ‘package:tidyr’:
extract
models <- list("Model 1" = model1,
"Model 2" = model2)
screenreg(models, stars = NULL)
================================
Model 1 Model 2
--------------------------------
(Intercept) 0.43 8101.98
(0.00) (276.50)
internet_use 0.00 413.17
(0.00) (7.32)
--------------------------------
R^2 0.15 0.35
Adj. R^2 0.15 0.35
Num. obs. 5313 5874
================================
Food production is responsible for one-quarter of the world’s greenhouse gas emissions.
What can you do to really reduce the carbon footprint of your breakfast, lunches, and dinner? ‘Eating local’ is a recommendation you hear often – even from prominent sources, including the United Nations. While it might make sense intuitively – after all, transport does lead to emissions – it is one of the most misguided pieces of advice.
GHG emissions from transportation make up a very small amount of the emissions from food and what you eat is far more important than where your food traveled from.
# library(tidyverse)
# library(owidR)
# library(texreg)owid_search("Food: greenhouse gas emissions across the supply chain") titles
[1,] "Food: greenhouse gas emissions across the supply chain"
chart_id
[1,] "food-emissions-supply-chain"
Greenhouse gas emissions are measured in carbon dioxide-equivalents (CO₂eq) per kilogram of food.
dff <- owid("food-emissions-supply-chain")
dffstr(dff)owid [43 × 11] (S3: owid/tbl_df/tbl/data.frame)
$ entity : chr [1:43] "Apples" "Bananas" "Barley" "Beef (beef herd)" ...
$ code : logi [1:43] NA NA NA NA NA NA ...
$ year : int [1:43] 2018 2018 2018 2018 2018 2018 2018 2018 2018 2018 ...
$ Land use change: num [1:43] -0.02895 -0.02553 0.00868 23.23754 1.26602 ...
$ Farm : num [1:43] 0.226 0.27 0.176 56.228 21.916 ...
$ Animal feed : num [1:43] 0 0 0 2.68 3.5 ...
$ Processing : num [1:43] 0.00382 0.06015 0.1277 1.81108 1.54766 ...
$ Transport : num [1:43] 0.0958 0.2958 0.0354 0.4941 0.5924 ...
$ Retail : num [1:43] 0.0166 0.021 0.2636 0.2335 0.254 ...
$ Packaging : num [1:43] 0.0445 0.0657 0.4968 0.3521 0.3745 ...
$ Losses : num [1:43] 0.0708 0.1752 0.0707 14.44 3.8475 ...
- attr(*, "data_info")=List of 8
..$ :List of 3
.. ..$ source :List of 7
.. .. ..$ id : int 18035
.. .. ..$ name : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublishedBy : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublisherSource: chr ""
.. .. ..$ link : chr "https://science.sciencemag.org/content/360/6392/987"
.. .. ..$ retrievedDate : chr ""
.. .. ..$ additionalInfo : chr "Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 s"| __truncated__
.. ..$ dataset_name: chr "food_emissions_land_use"
.. ..$ display :List of 4
.. .. ..$ name : chr "Land use change"
.. .. ..$ unit : chr "kgCO₂eq per kg"
.. .. ..$ shortUnit : chr "kg"
.. .. ..$ includeInTable: logi TRUE
..$ :List of 3
.. ..$ source :List of 7
.. .. ..$ id : int 18035
.. .. ..$ name : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublishedBy : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublisherSource: chr ""
.. .. ..$ link : chr "https://science.sciencemag.org/content/360/6392/987"
.. .. ..$ retrievedDate : chr ""
.. .. ..$ additionalInfo : chr "Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 s"| __truncated__
.. ..$ dataset_name: chr "food_emissions_farm"
.. ..$ display :List of 4
.. .. ..$ name : chr "Farm"
.. .. ..$ unit : chr "kgCO₂eq per kg"
.. .. ..$ shortUnit : chr "kg"
.. .. ..$ includeInTable: logi TRUE
..$ :List of 3
.. ..$ source :List of 7
.. .. ..$ id : int 18035
.. .. ..$ name : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublishedBy : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublisherSource: chr ""
.. .. ..$ link : chr "https://science.sciencemag.org/content/360/6392/987"
.. .. ..$ retrievedDate : chr ""
.. .. ..$ additionalInfo : chr "Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 s"| __truncated__
.. ..$ dataset_name: chr "food_emissions_animal_feed"
.. ..$ display :List of 4
.. .. ..$ name : chr "Animal feed"
.. .. ..$ unit : chr "kgCO₂eq per kg"
.. .. ..$ shortUnit : chr "kg"
.. .. ..$ includeInTable: logi TRUE
..$ :List of 3
.. ..$ source :List of 7
.. .. ..$ id : int 18035
.. .. ..$ name : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublishedBy : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublisherSource: chr ""
.. .. ..$ link : chr "https://science.sciencemag.org/content/360/6392/987"
.. .. ..$ retrievedDate : chr ""
.. .. ..$ additionalInfo : chr "Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 s"| __truncated__
.. ..$ dataset_name: chr "food_emissions_processing"
.. ..$ display :List of 4
.. .. ..$ name : chr "Processing"
.. .. ..$ unit : chr "kgCO₂eq per kg"
.. .. ..$ shortUnit : chr "kg"
.. .. ..$ includeInTable: logi TRUE
..$ :List of 3
.. ..$ source :List of 7
.. .. ..$ id : int 18035
.. .. ..$ name : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublishedBy : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublisherSource: chr ""
.. .. ..$ link : chr "https://science.sciencemag.org/content/360/6392/987"
.. .. ..$ retrievedDate : chr ""
.. .. ..$ additionalInfo : chr "Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 s"| __truncated__
.. ..$ dataset_name: chr "food_emissions_transport"
.. ..$ display :List of 4
.. .. ..$ name : chr "Transport"
.. .. ..$ unit : chr "kgCO₂eq per kg"
.. .. ..$ shortUnit : chr "kg"
.. .. ..$ includeInTable: logi TRUE
..$ :List of 3
.. ..$ source :List of 7
.. .. ..$ id : int 18035
.. .. ..$ name : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublishedBy : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublisherSource: chr ""
.. .. ..$ link : chr "https://science.sciencemag.org/content/360/6392/987"
.. .. ..$ retrievedDate : chr ""
.. .. ..$ additionalInfo : chr "Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 s"| __truncated__
.. ..$ dataset_name: chr "food_emissions_retail"
.. ..$ display :List of 4
.. .. ..$ name : chr "Retail"
.. .. ..$ unit : chr "kgCO₂eq per kg"
.. .. ..$ shortUnit : chr "kg"
.. .. ..$ includeInTable: logi TRUE
..$ :List of 3
.. ..$ source :List of 7
.. .. ..$ id : int 18035
.. .. ..$ name : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublishedBy : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublisherSource: chr ""
.. .. ..$ link : chr "https://science.sciencemag.org/content/360/6392/987"
.. .. ..$ retrievedDate : chr ""
.. .. ..$ additionalInfo : chr "Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 s"| __truncated__
.. ..$ dataset_name: chr "food_emissions_packaging"
.. ..$ display :List of 4
.. .. ..$ name : chr "Packaging"
.. .. ..$ unit : chr "kgCO₂eq per kg"
.. .. ..$ shortUnit : chr "kg"
.. .. ..$ includeInTable: logi TRUE
..$ :List of 3
.. ..$ source :List of 7
.. .. ..$ id : int 18035
.. .. ..$ name : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublishedBy : chr "Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science"| __truncated__
.. .. ..$ dataPublisherSource: chr ""
.. .. ..$ link : chr "https://science.sciencemag.org/content/360/6392/987"
.. .. ..$ retrievedDate : chr ""
.. .. ..$ additionalInfo : chr "Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 s"| __truncated__
.. ..$ dataset_name: chr "food_emissions_losses"
.. ..$ display :List of 4
.. .. ..$ name : chr "Losses"
.. .. ..$ unit : chr "kgCO₂eq per kg"
.. .. ..$ shortUnit : chr "kg"
.. .. ..$ includeInTable: logi TRUE
- attr(*, "chart_id")= chr "food-emissions-supply-chain"
owid_source(dff)Value:
Dataset Name: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Published By: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Link: https://science.sciencemag.org/content/360/6392/987
Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 study.
The authors note the following about the scope of the studies included in this meta-analysis:
"We derived data from a comprehensive meta-analysis, identifying 1530 studies for potential inclusion, which were supplemented with additional data received from 139 authors. Studies were assessed against 11 criteria designed to standardize methodology, resulting in 570 suitable studies with a median reference year of 2010. The data set covers ~38,700 commercially viable farms in 119 countries and 40 products representing ~90% of global protein and calorie consumption'.
All comparisons here are based on the global mean value per food product across all studies.
Comparisons can be made in functional units: here all comparisons are made as impacts per kilogram of product.Value:
Dataset Name: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Published By: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Link: https://science.sciencemag.org/content/360/6392/987
Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 study.
The authors note the following about the scope of the studies included in this meta-analysis:
"We derived data from a comprehensive meta-analysis, identifying 1530 studies for potential inclusion, which were supplemented with additional data received from 139 authors. Studies were assessed against 11 criteria designed to standardize methodology, resulting in 570 suitable studies with a median reference year of 2010. The data set covers ~38,700 commercially viable farms in 119 countries and 40 products representing ~90% of global protein and calorie consumption'.
All comparisons here are based on the global mean value per food product across all studies.
Comparisons can be made in functional units: here all comparisons are made as impacts per kilogram of product.Value:
Dataset Name: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Published By: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Link: https://science.sciencemag.org/content/360/6392/987
Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 study.
The authors note the following about the scope of the studies included in this meta-analysis:
"We derived data from a comprehensive meta-analysis, identifying 1530 studies for potential inclusion, which were supplemented with additional data received from 139 authors. Studies were assessed against 11 criteria designed to standardize methodology, resulting in 570 suitable studies with a median reference year of 2010. The data set covers ~38,700 commercially viable farms in 119 countries and 40 products representing ~90% of global protein and calorie consumption'.
All comparisons here are based on the global mean value per food product across all studies.
Comparisons can be made in functional units: here all comparisons are made as impacts per kilogram of product.Value:
Dataset Name: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Published By: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Link: https://science.sciencemag.org/content/360/6392/987
Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 study.
The authors note the following about the scope of the studies included in this meta-analysis:
"We derived data from a comprehensive meta-analysis, identifying 1530 studies for potential inclusion, which were supplemented with additional data received from 139 authors. Studies were assessed against 11 criteria designed to standardize methodology, resulting in 570 suitable studies with a median reference year of 2010. The data set covers ~38,700 commercially viable farms in 119 countries and 40 products representing ~90% of global protein and calorie consumption'.
All comparisons here are based on the global mean value per food product across all studies.
Comparisons can be made in functional units: here all comparisons are made as impacts per kilogram of product.Value:
Dataset Name: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Published By: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Link: https://science.sciencemag.org/content/360/6392/987
Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 study.
The authors note the following about the scope of the studies included in this meta-analysis:
"We derived data from a comprehensive meta-analysis, identifying 1530 studies for potential inclusion, which were supplemented with additional data received from 139 authors. Studies were assessed against 11 criteria designed to standardize methodology, resulting in 570 suitable studies with a median reference year of 2010. The data set covers ~38,700 commercially viable farms in 119 countries and 40 products representing ~90% of global protein and calorie consumption'.
All comparisons here are based on the global mean value per food product across all studies.
Comparisons can be made in functional units: here all comparisons are made as impacts per kilogram of product.Value:
Dataset Name: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Published By: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Link: https://science.sciencemag.org/content/360/6392/987
Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 study.
The authors note the following about the scope of the studies included in this meta-analysis:
"We derived data from a comprehensive meta-analysis, identifying 1530 studies for potential inclusion, which were supplemented with additional data received from 139 authors. Studies were assessed against 11 criteria designed to standardize methodology, resulting in 570 suitable studies with a median reference year of 2010. The data set covers ~38,700 commercially viable farms in 119 countries and 40 products representing ~90% of global protein and calorie consumption'.
All comparisons here are based on the global mean value per food product across all studies.
Comparisons can be made in functional units: here all comparisons are made as impacts per kilogram of product.Value:
Dataset Name: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Published By: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Link: https://science.sciencemag.org/content/360/6392/987
Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 study.
The authors note the following about the scope of the studies included in this meta-analysis:
"We derived data from a comprehensive meta-analysis, identifying 1530 studies for potential inclusion, which were supplemented with additional data received from 139 authors. Studies were assessed against 11 criteria designed to standardize methodology, resulting in 570 suitable studies with a median reference year of 2010. The data set covers ~38,700 commercially viable farms in 119 countries and 40 products representing ~90% of global protein and calorie consumption'.
All comparisons here are based on the global mean value per food product across all studies.
Comparisons can be made in functional units: here all comparisons are made as impacts per kilogram of product.Value:
Dataset Name: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Published By: Poore, J., & Nemecek, T. (2018). Reducing food’s environmental impacts through producers and consumers. Science, 360(6392), 987-992.
Link: https://science.sciencemag.org/content/360/6392/987
Data is based on the largest meta-analysis of food system impact studies to date, from Poore & Nemecek's 2018 study.
The authors note the following about the scope of the studies included in this meta-analysis:
"We derived data from a comprehensive meta-analysis, identifying 1530 studies for potential inclusion, which were supplemented with additional data received from 139 authors. Studies were assessed against 11 criteria designed to standardize methodology, resulting in 570 suitable studies with a median reference year of 2010. The data set covers ~38,700 commercially viable farms in 119 countries and 40 products representing ~90% of global protein and calorie consumption'.
All comparisons here are based on the global mean value per food product across all studies.
Comparisons can be made in functional units: here all comparisons are made as impacts per kilogram of product.
range(dff$year)[1] 2018 2018
unique(dff$entity) [1] "Apples" "Bananas" "Barley"
[4] "Beef (beef herd)" "Beef (dairy herd)" "Beet Sugar"
[7] "Berries & Grapes" "Brassicas" "Cane Sugar"
[10] "Cassava" "Cheese" "Citrus Fruit"
[13] "Coffee" "Dark Chocolate" "Eggs"
[16] "Fish (farmed)" "Groundnuts" "Lamb & Mutton"
[19] "Maize" "Milk" "Nuts"
[22] "Oatmeal" "Olive Oil" "Onions & Leeks"
[25] "Other Fruit" "Other Pulses" "Other Vegetables"
[28] "Palm Oil" "Peas" "Pig Meat"
[31] "Potatoes" "Poultry Meat" "Rapeseed Oil"
[34] "Rice" "Root Vegetables" "Shrimps (farmed)"
[37] "Soy milk" "Soybean Oil" "Sunflower Oil"
[40] "Tofu" "Tomatoes" "Wheat & Rye"
[43] "Wine"
view_chart(dff)food <- c("Beef (beef herd)" , "Palm Oil", "Cheese", "Eggs", "Fish (farmed)" , "Milk" , "Nuts", "Peas", "Rice")
dff %>% filter(entity %in% food) %>%
ggplot(aes(x = entity, y = Farm)) +
geom_col() +
labs(x = "food", y = "food-emissions-supply-chain", title = "A food-emissions-supply-chain : Farm") food <- c("Beef (beef herd)" , "Palm Oil", "Cheese", "Eggs", "Fish (farmed)" , "Milk" , "Nuts", "Peas", "Rice")
dff %>% filter(entity %in% food) %>%
ggplot(aes(x = entity, y = `Land use change`)) +
geom_col() +
labs(x = "food", y = "food-emissions-supply-chain", title = "A food-emissions-supply-chain : Land use change") food <- c("Beef (beef herd)" , "Palm Oil", "Cheese", "Eggs", "Fish (farmed)" , "Milk" , "Nuts", "Peas", "Rice")
dff %>% filter(entity %in% food) %>%
ggplot(aes(x = entity, y = Transport)) +
geom_col() +
labs(x = "food", y = "food-emissions-supply-chain", title = "A food-emissions-supply-chain : Transport") dff %>%
ggplot(aes(x = entity, y = Farm)) +
geom_col() +
labs(x = "food", y = "food-emissions-supply-chain", title = "A food-emissions-supply-chain") Before we look at trends in deforestation across the world specifically, it’s useful to understand the net change in forest cover. The net change in forest cover measures any gains in forest cover – either through natural forest expansion or afforestation through tree-planting – minus deforestation.
This map shows the net change in forest cover across the world. Countries with a positive change (shown in green) are regrowing forest faster than they’re losing it. Countries with a negative change (shown in red) are losing more than they’re able to restore.
# library(tidyverse)
# library(owidR)
# library(texreg)owid_search("Annual change in forest area") %>% as_tibble()Net change in forest area measures forest expansion (either through afforestation or natural expansion) minus deforestation
df0 <- owid("annual-change-forest-area", rename = "change_in_forest_area")
df0structures of the data
str(df0)owid [475 × 4] (S3: owid/tbl_df/tbl/data.frame)
$ entity : chr [1:475] "Algeria" "Algeria" "Algeria" "Algeria" ...
$ code : chr [1:475] "DZA" "DZA" "DZA" "DZA" ...
$ year : int [1:475] 1990 2000 2010 2015 1990 2000 2010 2015 1990 2000 ...
$ change_in_forest_area: num [1:475] -8800 33900 7600 -1400 -182600 ...
- attr(*, "data_info")=List of 1
..$ :List of 3
.. ..$ source :List of 7
.. .. ..$ id : int 17931
.. .. ..$ name : chr "UN Food and Agriculture Organization (FAO). Forest Resources Assessment."
.. .. ..$ dataPublishedBy : chr "UN Food and Agriculture Organization (FAO). Forest Resources Assessment 2020."
.. .. ..$ dataPublisherSource: chr ""
.. .. ..$ link : chr "https://fra-data.fao.org/"
.. .. ..$ retrievedDate : chr "20th October 2020"
.. .. ..$ additionalInfo : chr "Raw data for forest area, deforestation, afforestation and expansion is sourced from the UN FAO Forest Resource"| __truncated__
.. ..$ dataset_name: chr "Annual net change in forest area"
.. ..$ display :List of 6
.. .. ..$ name : chr "Annual change in forest area"
.. .. ..$ unit : chr "hectares per year"
.. .. ..$ shortUnit : chr "ha"
.. .. ..$ includeInTable : logi TRUE
.. .. ..$ conversionFactor: int 1000
.. .. ..$ numDecimalPlaces: int 0
- attr(*, "chart_id")= chr "annual-change-forest-area"
Get source information on Net change in forest area
owid_source(df0)Dataset Name: UN Food and Agriculture Organization (FAO). Forest Resources Assessment.
Published By: UN Food and Agriculture Organization (FAO). Forest Resources Assessment 2020.
Link: https://fra-data.fao.org/
Raw data for forest area, deforestation, afforestation and expansion is sourced from the UN FAO Forest Resources Assessment.
Our World in Data have calculated several metrics based on this raw data including:
– Net change in forest area (afforestation minus deforestation)
– Net conversion rate (net change as a percentage of forest area)
– Each country's share of global forest area, deforestation, afforestation, and net change in forests
– Each country's share of regional forest area, deforestation, afforestation, and net change in forests
The UN FAO publish forest area and forest change data as the annual average on 10- or 5-year timescales. Therefore the following year allocation applies:
– 1990: the annual average over the period from 1990 to 2000.
– 2000: the annual average over the period from 2000 to 2010.
– 2010: the annual average over the period from 2010 to 2015.
– 2015: the annual average over the period from 2015 to 2020.
Data on forest cover by country pre-1990 is sourced from a variety sources which are documented here: https://docs.google.com/spreadsheets/d/1nYpao4e8Ai-P86jIUZ3r7X6-5MjZ7ZbG7TJQSO729Bg/edit?usp=sharing
The range of years covered.
range(df0$year)[1] 1990 2015
unique(df0$entity) [1] "Algeria" "Argentina"
[3] "Aruba" "Australia"
[5] "Austria" "Azerbaijan"
[7] "Bahrain" "Bangladesh"
[9] "Belarus" "Belgium"
[11] "Belize" "Bhutan"
[13] "Bolivia" "Brazil"
[15] "Bulgaria" "Burundi"
[17] "Cameroon" "Canada"
[19] "Cape Verde" "Cayman Islands"
[21] "Central African Republic" "Chile"
[23] "China" "Colombia"
[25] "Congo" "Costa Rica"
[27] "Croatia" "Cuba"
[29] "Denmark" "Djibouti"
[31] "Dominican Republic" "Ecuador"
[33] "El Salvador" "Equatorial Guinea"
[35] "Estonia" "Ethiopia"
[37] "Falkland Islands" "Faroe Islands"
[39] "Finland" "French Guyana"
[41] "Gabon" "Georgia"
[43] "Germany" "Gibraltar"
[45] "Greenland" "Guadeloupe"
[47] "Guatemala" "Guinea"
[49] "Guyana" "Honduras"
[51] "Hungary" "Iceland"
[53] "India" "Indonesia"
[55] "Iraq" "Ireland"
[57] "Isle of Man" "Italy"
[59] "Jamaica" "Kuwait"
[61] "Kyrgyzstan" "Latvia"
[63] "Liberia" "Liechtenstein"
[65] "Lithuania" "Madagascar"
[67] "Malawi" "Maldives"
[69] "Mali" "Martinique"
[71] "Mauritania" "Mauritius"
[73] "Mayotte" "Mexico"
[75] "Moldova" "Monaco"
[77] "Mongolia" "Montenegro"
[79] "Morocco" "Mozambique"
[81] "Myanmar" "Nauru"
[83] "Nepal" "Netherlands"
[85] "New Zealand" "Nicaragua"
[87] "Niger" "Nigeria"
[89] "North Korea" "Norway"
[91] "Panama" "Papua New Guinea"
[93] "Paraguay" "Peru"
[95] "Poland" "Portugal"
[97] "Qatar" "Romania"
[99] "Russia" "San Marino"
[101] "Sao Tome and Principe" "Senegal"
[103] "Serbia" "Singapore"
[105] "Slovenia" "Somalia"
[107] "South Africa" "South Korea"
[109] "Spain" "Sudan"
[111] "Suriname" "Sweden"
[113] "Switzerland" "Syria"
[115] "Tanzania" "Thailand"
[117] "Togo" "Tokelau"
[119] "Tunisia" "Turkey"
[121] "Uganda" "Ukraine"
[123] "United Kingdom" "United States"
[125] "Uruguay" "Uzbekistan"
[127] "Vatican" "Venezuela"
[129] "Vietnam" "World"
[131] "Zambia" "Zimbabwe"
A function that opens the original OWID chart in your browser.
view_chart(df0)2.3 Set a Country
ggplot
df0 %>% filter(entity == "Brazil") %>%
ggplot() +
geom_line(aes(x = year, y = change_in_forest_area))+
labs(title = "Annual change in forest area")country <- c("Brazil", "Tanzania", "Indonesia", "China", "India")
df0 %>% filter(entity %in% country) %>%
ggplot() +
geom_line(aes(x = year, y = change_in_forest_area, color = entity))+
labs(x = "year", y = "change_in_forest_area", title = "Annual change in forest area")country <- c("Brazil", "Tanzania", "Indonesia", "China", "India")
df0 %>% filter(entity %in% country) %>%
ggplot() +
geom_line(aes(x = year, y = change_in_forest_area, color = entity))+
facet_wrap(vars(entity)) +
labs(x = "year", y = "change_in_forest_area", title = "Annual change in forest area")country <- c("Brazil", "Tanzania", "Indonesia", "China", "India")
df0 %>% filter(entity %in% country) %>%
ggplot() +
geom_boxplot(aes(x = year, y = change_in_forest_area, color = entity))+
facet_wrap(vars(entity)) +
labs(x = "year", y = "change_in_forest_area", title = "Annual change in forest area")country <- c("United Kingdom", "Spain", "Russia", "Egypt", "Nigeria")
internet %>% filter(entity %in% country) %>%
ggplot() +
geom_boxplot(aes(x = entity, y = internet_use)) +
labs(x = "year", y = "internet use (%)", title = "Share of the Population using the Internet")country <- c("Brazil", "Tanzania", "Indonesia", "China", "India")
df0 %>% filter(entity %in% country & year == 2010) %>%
ggplot(aes(x = entity, y = change_in_forest_area, fill = entity)) +
geom_bar(stat = "identity") +
scale_fill_brewer(palette='Set1')+
labs(x = "country", y = "change_in_forest_area", title = "Annual change in forest area in 2010") df0 %>% filter(year == "2015") %>%
ggplot() +
geom_histogram(aes(x = change_in_forest_area)) +
labs(title = "Annual change in forest area in 2015") country <- c("United Kingdom", "Spain", "Russia", "Egypt", "Nigeria")
internet %>% filter(entity %in% country) %>%
ggplot() +
geom_histogram(aes(aes(x = entity, fill = entity)x = internet_use, fill = entity)) +
labs(title = "Share of the Population using the Internet") country <- c("United Kingdom", "Spain", "Russia", "Egypt", "Nigeria")
internet %>% filter(entity %in% country) %>%
ggplot() +
geom_histogram(aes(y = internet_use, fill = entity)) +
labs(title = "Share of the Population using the Internet")creating a choropleth map
owid_map(df0, year = 2015, palette = "Set4") +
labs(title = "Annual change in forest area in 2015")Warning: Unknown palette Set4Loading required namespace: showtext
Failed with error: ‘there is no package called ‘showtext’’
Warning: importing fonts requires the showtext pacakge
owid_map(df0, year = 2010, palette = "Set4") +
labs(title = "Annual change in forest area in 2010")Warning: Unknown palette Set4Loading required namespace: showtext
Failed with error: ‘there is no package called ‘showtext’’
Warning: importing fonts requires the showtext pacakge
owid_map(df0, year = 2000, palette = "Set4") +
labs(title = "Annual change in forest area in 2000")Warning: Unknown palette Set4Loading required namespace: showtext
Failed with error: ‘there is no package called ‘showtext’’
Warning: importing fonts requires the showtext pacakge
owid_map(df0, year = 1990, palette = "Set4") +
labs(title = "Annual change in forest area in 1990")Warning: Unknown palette Set4Loading required namespace: showtext
Failed with error: ‘there is no package called ‘showtext’’
Warning: importing fonts requires the showtext pacakge
Net forest loss is not the same as deforestation – it measures deforestation plus any gains in forest over a given period.
Over the decade since 2010, the net loss in forests globally was 4.7 million hectares per year.1 However, deforestation rates were much significantly higher.
The UN FAO estimate that 10 million hectares of forest were cut down each year.
This interactive map shows deforestation rates across the world.
owid_search("Annual deforestation") %>% as_tibble()df1 <- owid("annual-deforestation")
df1owid_source(df1)Dataset Name: UN Food and Agriculture Organization (FAO). Forest Resources Assessment.
Published By: UN Food and Agriculture Organization (FAO). Forest Resources Assessment 2020.
Link: https://fra-data.fao.org/
Raw data for forest area, deforestation, afforestation and expansion is sourced from the UN FAO Forest Resources Assessment.
Our World in Data have calculated several metrics based on this raw data including:
– Net change in forest area (afforestation minus deforestation)
– Net conversion rate (net change as a percentage of forest area)
– Each country's share of global forest area, deforestation, afforestation, and net change in forests
– Each country's share of regional forest area, deforestation, afforestation, and net change in forests
The UN FAO publish forest area and forest change data as the annual average on 10- or 5-year timescales. Therefore the following year allocation applies:
– 1990: the annual average over the period from 1990 to 2000.
– 2000: the annual average over the period from 2000 to 2010.
– 2010: the annual average over the period from 2010 to 2015.
– 2015: the annual average over the period from 2015 to 2020.
Data on forest cover by country pre-1990 is sourced from a variety sources which are documented here: https://docs.google.com/spreadsheets/d/1nYpao4e8Ai-P86jIUZ3r7X6-5MjZ7ZbG7TJQSO729Bg/edit?usp=sharing
owid_map(df1, year = 2015, palette = "Set3") +
labs(title = "Annual deforestation rate")Loading required namespace: showtext
Failed with error: ‘there is no package called ‘showtext’’
Warning: importing fonts requires the showtext pacakge
In fact, the world may have already passed ‘peak agricultural land’ [we will look at this in more detail in an upcoming post]. And with the growth of technological innovations such as lab-grown meat and substitute products, there is the real possibility that we can continue to enjoy meat or meat-like foods while freeing up the massive amounts of land we use to raise livestock.
If we can take advantage of these innovations, we can bring deforestation to an end. A future with more people and more forest is possible.
There is a marked divide in the state of the world’s forests. In most rich countries, across Europe, North America and East Asia, forest cover is increasing, whilst in many low-to-middle income countries it’s decreasing.
But, it would be wrong to think that the only impact rich countries have on global forests is through changes in their domestic forests. They also contribute to global deforestation through the foods they import from poorer countries.
Today, most deforestation occurs in the tropics. 71% of this is driven by demand in domestic markets, and the remaining 29% for the production of products that are traded. 40% of traded deforestation ends up in high-income countries, meaning they are responsible for 12% of deforestation.29
Let’s take a look at which countries are causing deforestation overseas and the size of this impact.
High-income countries were the largest ‘importers’ of deforestation, accounting for 40% of it. This means they were responsible for 12% of global deforestation.31 It is therefore true that rich countries are causing deforestation in poorer countries.
owid_search("deforestation abroad") titles
[1,] "Who is contributing to deforestation abroad?"
chart_id
[1,] "net-deforestation-in-trade"
df3 <- owid("net-deforestation-in-trade")
df3range(df3$year)[1] 2005 2013
unique(df3$entity) [1] "Afghanistan"
[2] "Albania"
[3] "Algeria"
[4] "Angola"
[5] "Argentina"
[6] "Armenia"
[7] "Aruba"
[8] "Australia"
[9] "Austria"
[10] "Azerbaijan"
[11] "Bahamas"
[12] "Bahrain"
[13] "Bangladesh"
[14] "Barbados"
[15] "Belarus"
[16] "Belgium"
[17] "Belize"
[18] "Benin"
[19] "Bermuda"
[20] "Bhutan"
[21] "Bosnia and Herzegovina"
[22] "Botswana"
[23] "Brazil"
[24] "Brunei"
[25] "Bulgaria"
[26] "Burkina Faso"
[27] "Burundi"
[28] "Cambodia"
[29] "Cameroon"
[30] "Canada"
[31] "Cape Verde"
[32] "Cayman Islands"
[33] "Central African Republic"
[34] "Chad"
[35] "Chile"
[36] "China"
[37] "Colombia"
[38] "Congo"
[39] "Cook Islands"
[40] "Costa Rica"
[41] "Cote d'Ivoire"
[42] "Croatia"
[43] "Cuba"
[44] "Cyprus"
[45] "Democratic Republic of Congo"
[46] "Denmark"
[47] "Djibouti"
[48] "Dominica"
[49] "Dominican Republic"
[50] "Ecuador"
[51] "Egypt"
[52] "El Salvador"
[53] "Equatorial Guinea"
[54] "Eritrea"
[55] "Estonia"
[56] "Ethiopia"
[57] "Fiji"
[58] "Finland"
[59] "France"
[60] "French Guiana"
[61] "French Polynesia"
[62] "Gabon"
[63] "Gambia"
[64] "Georgia"
[65] "Germany"
[66] "Ghana"
[67] "Greece"
[68] "Grenada"
[69] "Guadeloupe"
[70] "Guatemala"
[71] "Guinea"
[72] "Guinea-Bissau"
[73] "Guyana"
[74] "Haiti"
[75] "Honduras"
[76] "Hong Kong"
[77] "Hungary"
[78] "Iceland"
[79] "India"
[80] "Indonesia"
[81] "Iran"
[82] "Iraq"
[83] "Ireland"
[84] "Israel"
[85] "Italy"
[86] "Jamaica"
[87] "Japan"
[88] "Jordan"
[89] "Kazakhstan"
[90] "Kenya"
[91] "Kiribati"
[92] "Kuwait"
[93] "Kyrgyzstan"
[94] "Laos"
[95] "Latvia"
[96] "Lebanon"
[97] "Lesotho"
[98] "Liberia"
[99] "Libya"
[100] "Lithuania"
[101] "Luxembourg"
[102] "Macao"
[103] "Madagascar"
[104] "Malawi"
[105] "Malaysia"
[106] "Maldives"
[107] "Mali"
[108] "Malta"
[109] "Martinique"
[110] "Mauritania"
[111] "Mauritius"
[112] "Mexico"
[113] "Moldova"
[114] "Mongolia"
[115] "Montenegro"
[116] "Morocco"
[117] "Mozambique"
[118] "Myanmar"
[119] "Namibia"
[120] "Nepal"
[121] "Netherlands"
[122] "New Caledonia"
[123] "New Zealand"
[124] "Nicaragua"
[125] "Niger"
[126] "Nigeria"
[127] "North Korea"
[128] "Norway"
[129] "Oman"
[130] "Pakistan"
[131] "Palestine"
[132] "Panama"
[133] "Papua New Guinea"
[134] "Paraguay"
[135] "Peru"
[136] "Philippines"
[137] "Poland"
[138] "Portugal"
[139] "Qatar"
[140] "Reunion"
[141] "Romania"
[142] "Russia"
[143] "Rwanda"
[144] "Saint Lucia"
[145] "Saint Vincent and the Grenadines"
[146] "Samoa"
[147] "Sao Tome and Principe"
[148] "Saudi Arabia"
[149] "Senegal"
[150] "Serbia"
[151] "Seychelles"
[152] "Sierra Leone"
[153] "Singapore"
[154] "Slovakia"
[155] "Slovenia"
[156] "Solomon Islands"
[157] "Somalia"
[158] "South Africa"
[159] "South Korea"
[160] "Spain"
[161] "Sri Lanka"
[162] "Sudan"
[163] "Suriname"
[164] "Sweden"
[165] "Switzerland"
[166] "Syria"
[167] "Taiwan"
[168] "Tajikistan"
[169] "Tanzania"
[170] "Thailand"
[171] "Timor"
[172] "Togo"
[173] "Tonga"
[174] "Trinidad and Tobago"
[175] "Tunisia"
[176] "Turkey"
[177] "Turkmenistan"
[178] "Uganda"
[179] "Ukraine"
[180] "United Arab Emirates"
[181] "United Kingdom"
[182] "United States"
[183] "Uruguay"
[184] "Uzbekistan"
[185] "Vanuatu"
[186] "Venezuela"
[187] "Vietnam"
[188] "Yemen"
[189] "Zambia"
[190] "Zimbabwe"
owid_source(df3)Dataset Name: Pendrill, F., Persson, U. M., Godar, J., & Kastner, T. (2019). Deforestation displaced: trade in forest-risk commodities and the prospects for a global forest transition.
Published By: Pendrill, F., Persson, U. M., Godar, J., & Kastner, T. (2019). Deforestation displaced: trade in forest-risk commodities and the prospects for a global forest transition. Environmental Research Letters, 14(5), 055003.
Link: https://iopscience.iop.org/article/10.1088/1748-9326/ab0d41
Pendrill et al. (2019) developed a land-balance model which attributed detected forest loss across the world to the expansion of croplands, pasture and tree plantations. This is then linked to particular agricultural commodities based on national land use, crop and forest product statistics published in the UN Food and Agricultural Organization balance sheets.
This study maps deforestation embedded in the international trade of these products using both a physical trade model, and a MRIO (multi-regional input-output) model. This allows for the quantification of deforestation embedded in imported food and forestry products.
Pendrill et al. (2019) provide data on exported and imported deforestation. Our World in Data have additionally calculated the net deforestation embedded in trade for each country by subtracting exports from imports.
country <- c("India", "Germany", "France", "Australia", "Brazil")
df3 %>% filter(entity %in% country) %>%
ggplot() +
geom_line(aes(x = year, y = `Net deforestation embedded in trade`, color = entity))+
labs(x = "year", y = "net-deforestation-in-trade", title = "Who is contributing to deforestation abroad?")owid_map(df3, year = 2010, palette = "Set4") +
labs(title = "Who is contributing to deforestation abroad?")Warning: Unknown palette Set4Loading required namespace: showtext
Failed with error: ‘there is no package called ‘showtext’’
Warning: importing fonts requires the showtext pacakge
owid_search("Change in domestic forest area") %>% as_tibble()df4 <- owid("domestic-forest-change-vs-imported-deforestation")
df4owid_search("deforestation embedded in imported goods") titles
[1,] "Change in domestic forest area vs. deforestation embedded in imported goods"
chart_id
[1,] "domestic-forest-change-vs-imported-deforestation"
df4 <- owid("domestic-forest-change-vs-imported-deforestation")
df4range(df4$year)[1] 1990 2015
unique(df4$entity) [1] "Algeria"
[2] "Argentina"
[3] "Aruba"
[4] "Australia"
[5] "Austria"
[6] "Azerbaijan"
[7] "Bahrain"
[8] "Bangladesh"
[9] "Belarus"
[10] "Belgium"
[11] "Belize"
[12] "Bhutan"
[13] "Bolivia"
[14] "Brazil"
[15] "Bulgaria"
[16] "Burundi"
[17] "Cameroon"
[18] "Canada"
[19] "Cape Verde"
[20] "Cayman Islands"
[21] "Central African Republic"
[22] "Chile"
[23] "China"
[24] "Colombia"
[25] "Congo"
[26] "Costa Rica"
[27] "Croatia"
[28] "Cuba"
[29] "Denmark"
[30] "Djibouti"
[31] "Dominican Republic"
[32] "Ecuador"
[33] "El Salvador"
[34] "Equatorial Guinea"
[35] "Estonia"
[36] "Ethiopia"
[37] "Falkland Islands"
[38] "Faroe Islands"
[39] "Finland"
[40] "French Guyana"
[41] "Gabon"
[42] "Georgia"
[43] "Germany"
[44] "Gibraltar"
[45] "Greenland"
[46] "Guadeloupe"
[47] "Guatemala"
[48] "Guinea"
[49] "Guyana"
[50] "Honduras"
[51] "Hungary"
[52] "Iceland"
[53] "India"
[54] "Indonesia"
[55] "Iraq"
[56] "Ireland"
[57] "Isle of Man"
[58] "Italy"
[59] "Jamaica"
[60] "Kuwait"
[61] "Kyrgyzstan"
[62] "Latvia"
[63] "Liberia"
[64] "Liechtenstein"
[65] "Lithuania"
[66] "Madagascar"
[67] "Malawi"
[68] "Maldives"
[69] "Mali"
[70] "Martinique"
[71] "Mauritania"
[72] "Mauritius"
[73] "Mayotte"
[74] "Mexico"
[75] "Moldova"
[76] "Monaco"
[77] "Mongolia"
[78] "Montenegro"
[79] "Morocco"
[80] "Mozambique"
[81] "Myanmar"
[82] "Nauru"
[83] "Nepal"
[84] "Netherlands"
[85] "New Zealand"
[86] "Nicaragua"
[87] "Niger"
[88] "Nigeria"
[89] "North Korea"
[90] "Norway"
[91] "Panama"
[92] "Papua New Guinea"
[93] "Paraguay"
[94] "Peru"
[95] "Poland"
[96] "Portugal"
[97] "Qatar"
[98] "Romania"
[99] "Russia"
[100] "San Marino"
[101] "Sao Tome and Principe"
[102] "Senegal"
[103] "Serbia"
[104] "Singapore"
[105] "Slovenia"
[106] "Somalia"
[107] "South Africa"
[108] "South Korea"
[109] "Spain"
[110] "Sudan"
[111] "Suriname"
[112] "Sweden"
[113] "Switzerland"
[114] "Syria"
[115] "Tanzania"
[116] "Thailand"
[117] "Togo"
[118] "Tokelau"
[119] "Tunisia"
[120] "Turkey"
[121] "Uganda"
[122] "Ukraine"
[123] "United Kingdom"
[124] "United States"
[125] "Uruguay"
[126] "Uzbekistan"
[127] "Vatican"
[128] "Venezuela"
[129] "Vietnam"
[130] "World"
[131] "Zambia"
[132] "Zimbabwe"
[133] "Afghanistan"
[134] "Albania"
[135] "Angola"
[136] "Armenia"
[137] "Bahamas"
[138] "Barbados"
[139] "Benin"
[140] "Bermuda"
[141] "Bosnia and Herzegovina"
[142] "Botswana"
[143] "Brunei"
[144] "Burkina Faso"
[145] "Cambodia"
[146] "Chad"
[147] "Cook Islands"
[148] "Cote d'Ivoire"
[149] "Cyprus"
[150] "Democratic Republic of Congo"
[151] "Dominica"
[152] "Egypt"
[153] "Eritrea"
[154] "Fiji"
[155] "France"
[156] "French Guiana"
[157] "French Polynesia"
[158] "Gambia"
[159] "Ghana"
[160] "Greece"
[161] "Grenada"
[162] "Guinea-Bissau"
[163] "Haiti"
[164] "Hong Kong"
[165] "Iran"
[166] "Israel"
[167] "Japan"
[168] "Jordan"
[169] "Kazakhstan"
[170] "Kenya"
[171] "Kiribati"
[172] "Laos"
[173] "Lebanon"
[174] "Lesotho"
[175] "Libya"
[176] "Luxembourg"
[177] "Macao"
[178] "Malaysia"
[179] "Malta"
[180] "Namibia"
[181] "New Caledonia"
[182] "Oman"
[183] "Pakistan"
[184] "Palestine"
[185] "Philippines"
[186] "Reunion"
[187] "Rwanda"
[188] "Saint Lucia"
[189] "Saint Vincent and the Grenadines"
[190] "Samoa"
[191] "Saudi Arabia"
[192] "Seychelles"
[193] "Sierra Leone"
[194] "Slovakia"
[195] "Solomon Islands"
[196] "Sri Lanka"
[197] "Taiwan"
[198] "Tajikistan"
[199] "Timor"
[200] "Tonga"
[201] "Trinidad and Tobago"
[202] "Turkmenistan"
[203] "United Arab Emirates"
[204] "Vanuatu"
[205] "Yemen"
[206] "Abkhazia"
[207] "Akrotiri and Dhekelia"
[208] "Åland Islands"
[209] "American Samoa"
[210] "Andorra"
[211] "Anguilla"
[212] "Antarctica"
[213] "Antigua and Barbuda"
[214] "Austria-Hungary"
[215] "Baden"
[216] "Bavaria"
[217] "Bonaire Sint Eustatius and Saba"
[218] "Bouvet Island"
[219] "British Indian Ocean Territory"
[220] "British Virgin Islands"
[221] "Channel Islands"
[222] "Christmas Island"
[223] "Cocos Islands"
[224] "Comoros"
[225] "Curacao"
[226] "Czechia"
[227] "Czechoslovakia"
[228] "East Germany"
[229] "Eritrea and Ethiopia"
[230] "Eswatini"
[231] "Faeroe Islands"
[232] "French Southern Territories"
[233] "Guam"
[234] "Guernsey"
[235] "Hanover"
[236] "Heard Island and McDonald Islands"
[237] "Hesse Electoral"
[238] "Hesse Grand Ducal"
[239] "Jersey"
[240] "Kosovo"
[241] "Marshall Islands"
[242] "Mecklenburg Schwerin"
[243] "Micronesia (country)"
[244] "Modena"
[245] "Montserrat"
[246] "Nagorno-Karabakh"
[247] "Netherlands Antilles"
[248] "Niue"
[249] "Norfolk Island"
[250] "North Macedonia"
[251] "Northern Cyprus"
[252] "Northern Mariana Islands"
[253] "Palau"
[254] "Parma"
[255] "Pitcairn"
[256] "Puerto Rico"
[257] "Republic of Vietnam"
[258] "Saint Barthélemy"
[259] "Saint Helena"
[260] "Saint Kitts and Nevis"
[261] "Saint Martin (French part)"
[262] "Saint Pierre and Miquelon"
[263] "Saxony"
[264] "Serbia and Montenegro"
[265] "Serbia excluding Kosovo"
[266] "Sint Maarten (Dutch part)"
[267] "Somaliland"
[268] "South Georgia and the South Sandwich Islands"
[269] "South Ossetia"
[270] "South Sudan"
[271] "Svalbard and Jan Mayen"
[272] "Transnistria"
[273] "Turks and Caicos Islands"
[274] "Tuscany"
[275] "Tuvalu"
[276] "Two Sicilies"
[277] "United Korea"
[278] "United States Minor Outlying Islands"
[279] "United States Virgin Islands"
[280] "USSR"
[281] "Wallis and Futuna"
[282] "West Germany"
[283] "Western Sahara"
[284] "Wuerttemburg"
[285] "Yemen Arab Republic"
[286] "Yemen People's Republic"
[287] "Yugoslavia"
[288] "Zanzibar"
owid_source(df4)Value:
Dataset Name: UN Food and Agriculture Organization (FAO). Forest Resources Assessment.
Published By: UN Food and Agriculture Organization (FAO). Forest Resources Assessment 2020.
Link: https://fra-data.fao.org/
Raw data for forest area, deforestation, afforestation and expansion is sourced from the UN FAO Forest Resources Assessment.
Our World in Data have calculated several metrics based on this raw data including:
– Net change in forest area (afforestation minus deforestation)
– Net conversion rate (net change as a percentage of forest area)
– Each country's share of global forest area, deforestation, afforestation, and net change in forests
– Each country's share of regional forest area, deforestation, afforestation, and net change in forests
The UN FAO publish forest area and forest change data as the annual average on 10- or 5-year timescales. Therefore the following year allocation applies:
– 1990: the annual average over the period from 1990 to 2000.
– 2000: the annual average over the period from 2000 to 2010.
– 2010: the annual average over the period from 2010 to 2015.
– 2015: the annual average over the period from 2015 to 2020.
Data on forest cover by country pre-1990 is sourced from a variety sources which are documented here: https://docs.google.com/spreadsheets/d/1nYpao4e8Ai-P86jIUZ3r7X6-5MjZ7ZbG7TJQSO729Bg/edit?usp=sharingValue:
Dataset Name: Pendrill, F., Persson, U. M., Godar, J., & Kastner, T. (2019). Deforestation displaced: trade in forest-risk commodities and the prospects for a global forest transition.
Published By: Pendrill, F., Persson, U. M., Godar, J., & Kastner, T. (2019). Deforestation displaced: trade in forest-risk commodities and the prospects for a global forest transition. Environmental Research Letters, 14(5), 055003.
Link: https://iopscience.iop.org/article/10.1088/1748-9326/ab0d41
Pendrill et al. (2019) developed a land-balance model which attributed detected forest loss across the world to the expansion of croplands, pasture and tree plantations. This is then linked to particular agricultural commodities based on national land use, crop and forest product statistics published in the UN Food and Agricultural Organization balance sheets.
This study maps deforestation embedded in the international trade of these products using both a physical trade model, and a MRIO (multi-regional input-output) model. This allows for the quantification of deforestation embedded in imported food and forestry products.
Pendrill et al. (2019) provide data on exported and imported deforestation. Our World in Data have additionally calculated the net deforestation embedded in trade for each country by subtracting exports from imports.Value:
Dataset Name: Our World In Data
Published By: Our World In Data
Link:
country <- c("South America", "Northern America", "Africa", "World", "Eastern Asia" , "Western Europe", "Southeast Asia")
df4 %>% filter(entity %in% country) %>%
ggplot() +
geom_line(aes(x = year, y =`Annual change in forest area`, color = entity))+
labs(x = "year", y = "Annual change in forest areaa", title = "Annual change in forest area")NAdf4owid_search("Agricultural land per capita") titles chart_id
[1,] "Agricultural land per capita" "agricultural-area-per-capita"
df_a <- owid("agricultural-area-per-capita")country <- c("South America", "Northern America", "Africa", "World", "Eastern Asia" , "Western Europe", "Southeast Asia")
df4 %>% filter(entity %in% country) %>%
ggplot() +
geom_line(aes(x = year, y = `Agricultural land per capita`, color = entity))+
labs(x = "year", y = "agricultural-area-per-capita", title = "Agricultural-area-per-capita")
df4$`Annual change in forest area`df_aERROR
country <- c("South America", "Northern America", "Africa", "World", "Eastern Asia" , "Western Europe", "Southeast Asia")
df4 %>% filter(entity %in% country) %>%
ggplot() +
geom_line(aes(x = year, y = `Agricultural land per capita`, color = entity))+
labs(x = "year", y = "agricultural-area-per-capita", title = "Agricultural-area-per-capita")
df4$`Annual change in forest area`owid_map(df_a, year = 2010, palette = "Set3") +
labs(title = "Agricultural land per capita")Loading required namespace: showtext
Failed with error: ‘there is no package called ‘showtext’’
Warning: importing fonts requires the showtext pacakge
owid_map(df2, year = 2010, palette = "Set3") +
labs(title = "Agricultural land per capita")owid_map(df_a, year = 2010, palette = "Set3") +
labs(title = "Agricultural land per capita")Loading required namespace: showtext
Failed with error: ‘there is no package called ‘showtext’’
Warning: importing fonts requires the showtext pacakge
owid_map(df4, year = 2010, palette = "Set3") +
labs(title = "Agricultural land per capita")owid_plot(democracy, summarise = FALSE, filter = c("United Kingdom", "Spain", "Russia", "Egypt", "Nigeria")) +
labs(title = "electoral-democracy") +
scale_y_continuous(limits = c(0, 1), labels = scales::label_number(suffix = "%")) # The labels argument allows you to make it clear that the value is a percentageLoading required namespace: showtext
Failed with error: ‘there is no package called ‘showtext’’
Warning: importing fonts requires the showtext pacakgeWarning: 'scale_colour_owid' is deprecated.
See help("Deprecated")
#> Warning: 'scale_colour_owid' is deprecated.
#> See help("Deprecated")gdp <- owid("gdp-per-capita-worldbank", rename = "gdp")
gov_exp <- owid("total-gov-expenditure-gdp-wdi", rename = "gov_exp")
age_dep <- owid("age-dependency-ratio-of-working-age-population", rename = "age_dep")
unemployment <- owid("unemployment-rate", rename = "unemp")Mutating joins
left_join(): includes all rows in x.
data <- internet %>%
left_join(democracy) %>%
left_join(gdp) %>%
left_join(gov_exp) %>%
left_join(age_dep) %>%
left_join(unemployment)Joining, by = c("entity", "code", "year")Joining, by = c("entity", "code", "year")Joining, by = c("entity", "code", "year")Joining, by = c("entity", "code", "year")Joining, by = c("entity", "code", "year")
Drawing scatter plot
data %>%
filter(year == 2015) %>%
ggplot(aes(internet_use, electoral_democracy)) +
geom_point(colour = "#57677D", na.rm = TRUE) +
geom_smooth(method = "lm", colour = "#DC5E78", na.rm = TRUE) +
labs(title = "Relationship Between Internet Use and electoral_democracy", x = "Internet Use", y = "electoral_democracy") +
theme_owid()Failed with error: ‘there is no package called ‘showtext’’
data %>%
filter(year == 2015) %>%
ggplot(aes(gdp, internet_use)) +
geom_point(colour = "blue") +
geom_smooth(method = "gam", colour = "red", level = 0.0) +
labs(title = "Relationship Between Internet Use and GDP", x = "GDP", y = "Internet Use")model1 <- lm(electoral_democracy ~ internet_use, data)
summary(model1)
Call:
lm(formula = electoral_democracy ~ internet_use, data = data)
Residuals:
Min 1Q Median 3Q Max
-0.76097 -0.20192 0.02248 0.18764 0.48558
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.4283461 0.0042829 100.01 <2e-16 ***
internet_use 0.0035522 0.0001166 30.46 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.2475 on 5311 degrees of freedom
(1347 observations deleted due to missingness)
Multiple R-squared: 0.1487, Adjusted R-squared: 0.1485
F-statistic: 927.7 on 1 and 5311 DF, p-value: < 2.2e-16
model2 <- lm(gdp ~ internet_use, data)
summary(model2)
Call:
lm(formula = gdp ~ internet_use, data = data)
Residuals:
Min 1Q Median 3Q Max
-35872 -7670 -4496 3306 126683
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8101.982 276.503 29.30 <2e-16 ***
internet_use 413.174 7.315 56.48 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 16350 on 5872 degrees of freedom
(786 observations deleted due to missingness)
Multiple R-squared: 0.352, Adjusted R-squared: 0.3519
F-statistic: 3190 on 1 and 5872 DF, p-value: < 2.2e-16
Creating a table of the results of the regression analysis
library(texreg)models <- list("Model 1" = model1,
"Model 2" = model2)
screenreg(models, stars = NULL)
================================
Model 1 Model 2
--------------------------------
(Intercept) 0.43 8101.98
(0.00) (276.50)
internet_use 0.00 413.17
(0.00) (7.32)
--------------------------------
R^2 0.15 0.35
Adj. R^2 0.15 0.35
Num. obs. 5313 5874
================================
In statistics, a generalized additive model (GAM) is a generalized linear model in which the linear response variable depends linearly on unknown smooth functions of some predictor variables, and interest focuses on inference about these smooth functions.
The model relates a univariate response variable, Y, to some predictor variables, xi. An exponential family distribution is specified for Y (for example normal, binomial or Poisson distributions) along with a link function g (for example the identity or log functions) relating the expected value of Y to the predictor variables via a structure such as
\[g(\operatorname {E}(Y))=\beta _{0}+f_{1}(x_{1})+f_{2}(x_{2})+\cdots +f_{m}(x_{m}).\]
The functions \(f_i\) may be functions with a specified parametric form (for example a polynomial, or an un-penalized regression spline of a variable) or may be specified non-parametrically, or semi-parametrically, simply as ‘smooth functions’, to be estimated by non-parametric means. So a typical GAM might use a scatterplot smoothing function, such as a locally weighted mean, for \(f_1(x_1)\), and then use a factor model for \(f_2(x_2)\). This flexibility to allow non-parametric fits with relaxed assumptions on the actual relationship between response and predictor, provides the potential for better fits to data than purely parametric models, but arguably with some loss of interpretability.
datamodel1 <- lm(electoral_democracy ~ internet_use, data)
model2 <- lm(gdp ~ internet_use, data)
data_rev <- data %>% pivot_longer(-(1:4), names_to = "ind", values_to = "value")
data_revby_ind <- data_rev %>% group_by(ind) %>% nest()
by_indby_ind$data[[1]]ind_model <- function(df) {
lm(internet_use ~ value, data = df)
}by_ind$data[[2]] %>% ind_model()
Call:
lm(formula = internet_use ~ value, data = df)
Coefficients:
(Intercept) value
1.269 38.455
model1
Call:
lm(formula = electoral_democracy ~ internet_use, data = data)
Coefficients:
(Intercept) internet_use
0.428346 0.003552
models <- map(by_ind$data, ind_model)models[[1]]
Call:
lm(formula = internet_use ~ value, data = df)
Coefficients:
(Intercept) value
1.124 41.862
[[2]]
Call:
lm(formula = internet_use ~ value, data = df)
Coefficients:
(Intercept) value
1.269 38.455
[[3]]
Call:
lm(formula = internet_use ~ value, data = df)
Coefficients:
(Intercept) value
1.36 44.99
[[4]]
Call:
lm(formula = internet_use ~ value, data = df)
Coefficients:
(Intercept) value
8.677328 0.000852
[[5]]
Call:
lm(formula = internet_use ~ value, data = df)
Coefficients:
(Intercept) value
14.8826 0.5876
[[6]]
Call:
lm(formula = internet_use ~ value, data = df)
Coefficients:
(Intercept) value
74.1045 -0.7958
[[7]]
Call:
lm(formula = internet_use ~ value, data = df)
Coefficients:
(Intercept) value
24.35988 -0.08862
by_ind <- by_ind %>% mutate(model = map(data, ind_model))
by_indglance <- by_ind %>%
mutate(glance = map(model, broom::glance)) %>%
unnest(glance, .drop = TRUE)
glanceglance %>% arrange(desc(r.squared))tidy <- by_ind %>%
mutate(tidy = map(model, broom::tidy)) %>%
unnest(tidy, .drop = TRUE)
tidymodels[[1]]$coefficients %>% as.list() %>% as_tibble()%>% rename(c("intercept" = "(Intercept)", "slope" = "value" ))coeff <- function(m) {
rename(as_tibble(as.list(m$coefficients)), "intercept" = "(Intercept)", "slope" = "value")
}coeff(lm(cars))Error in `rename()`:
! Can't rename columns that don't exist.
✖ Column `value` doesn't exist.
Backtrace:
1. global coeff(lm(cars))
3. dplyr:::rename.data.frame(...)
rename(as_tibble(as.list(lm(cars)$coefficients)), "intercept"="(Intercept)")lm(cars)$coefficients(Intercept) dist
8.2839056 0.1655676
as_tibble(as.list(lm(cars)$coefficients))[,1]broom::tidy(lm(cars)) %>% select(1:2) %>% pivot_wider(names_from = term, values_from = estimate)model_quality <- by_ind %>%
mutate(glance = map(model, broom::glance)) %>%
mutate()
unnest(glance, .drop = TRUE)
glance